<template>
  <div id="qrCodeViewReport"></div>
</template>

<script>
import { scanQRcodeReportUrl } from "@/api/viewReport";
import Pdfh5 from "pdfh5";

export default {
  name: "viewReport",
  components: {},
  data() {
    return {
      pdfh5: null,
    };
  },
  created() {
    const linkId = this.$route.params?.linkId;
    console.log(linkId);
    if (!linkId) return;
    scanQRcodeReportUrl(linkId)
      .then((response) => {
        console.log(response);
        if (!response.msg) {
          this.$message.error("二维码已失效!");
        } else {
          this.pdfh5 = new Pdfh5(document.querySelector("#qrCodeViewReport"), {
            pdfurl: response.msg,
          });
        }
      })
      .catch((error) => {
        console.log(error);
      });
  },
};
</script>

<style scoped lang="scss"></style>
